package com.qizhou.compiler.enitity.func

import com.qizhou.annotation.AutoApi
import com.qizhou.compiler.aptUtils.types.asKotlinTypeName
import com.qizhou.compiler.enitity.ReposityMothed
import com.sun.tools.javac.code.Symbol
import javax.lang.model.element.ExecutableElement

class AutoMethod (private val mExecutableElement: ExecutableElement) : ReposityMothed(mExecutableElement) {

    override fun isfilterCommonParseModel():Boolean{
        val annotation: AutoApi = executableElement.getAnnotation(AutoApi::class.java)
        val isFilterHttpCode = annotation.filterCommonParseModel
        return isFilterHttpCode
    }

    override fun initParameters() {

        val annotation: AutoApi = executableElement.getAnnotation(AutoApi::class.java)
        val defaultVMap = HashMap<String,String>()
        annotation.keys.forEachIndexed { index, s ->
            defaultVMap[s] = annotation.defaultValues[index]
        }
        executableElement.parameters.forEach {
            parameters.add(Parameter(it.simpleName.toString(), it.asType().asKotlinTypeName(),defaultVMap[it.simpleName.toString()]))
        }
    }




}